<?php if(!is_null($this->v('data'))):?>
	<?php if (is_array($this->v('icons'))):?>
		<?php print formx();?>
		<table class="x">
		<tr>
			<th>Category</th>
			<th>Icon</th>
		</tr>
		<?php foreach ($this->v('data') AS $key => $value):?>
			<tr>
			    <td><b><?php print $value['name'];?></b> (<?php print $value['posts'];?> post<?php print ($value['posts']!=1?'s':'');?>)<br/><i><?php print $value['desc'];?></i></td>
			    <td>
			    	<div class="selects">
				    	<label for="<?php print $key.'[color]';?>">Color:</label>
				    	<?php print select(range(1, $this->v('icons','colors')),$value['color'],$key.'[color]',array('class'=>$key.' c'));?><br/>
				    	<label for="<?php print $key.'[type]';?>">Type:</label>
				    	<?php print select(range(1, $this->v('icons','types')),$value['type'],$key.'[type]',array('class'=>$key.' l'));?>
			    	</div>
			    	<div class="control">
			    		<div class="top"></div>
			    		<div class="right"></div>
			    		<div class="bottom"></div>
			    		<div class="left"></div>
			    		<div class="image octoms-category <?php print $key;?> l<?php print $value['type']+1;?> c<?php print $value['color']+1;?>"></div>
			    	</div>
			    	
			    </td>
			</tr>
		<?php endforeach;?>
		
		</table>
		<?php print submit('Update').form(true);?>
	<?php else:?>
		<p>File <b><?php print $this->v('icons');?></b> is missing. Please restore it and try again.</p>
	<?php endif;?>
<?php else:?>
<p>There are no categories defined. <a href="<?php print str_replace('admin.php', 'edit-tags.php?taxonomy=category', ADMINROOT);?>">Add one.</a></p>
<?php endif;?>